/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.treater;

import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.actor.ClientModel;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.exception.CodeNotExistsException;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.exception.TreaterNuloExeption;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.ClientControler;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.util.Message;

/**
 *
 * @author Jorge
 */
public class TreaterRemoveChat extends TreaterNotification{

    @Override
    public void treatNotification(ClientControler client, Message message) throws CodeNotExistsException, TreaterNuloExeption {
         if(message.getCode() == Message.REMOVE_CHAT){

            client.removeChat((Integer)message.getContent());
        }else{
            if(next != null){
                next.treatNotification(client, message);
            }else{
                throw new CodeNotExistsException();
            }
        }
    }

}
